package com.meisiabc.app.web.auth;

import com.meisiabc.utils.Verify;

/**
 * Created by sunchangpeng.
 */
public class SecurityContextHolder {
    private static final ThreadLocal<SecurityContext> contextHolder = new ThreadLocal<SecurityContext>();

    public static void setContext(SecurityContext context) {
        Verify.notNull(context, "Only non-null SecurityContext instances are permitted");
        contextHolder.set(context);
    }

    public static SecurityContext getContext() {
        return contextHolder.get();
    }

    public static void clearContext() {
        contextHolder.remove();
    }
}
